Skip to content

feat(native-memory): semantic memory, cross-session context, skill management commands#4509

Closed
herjarsa wants to merge 23 commits into
code-yeongyu:devfrom
herjarsa:feat/native-memory-foundation
Closed

feat(native-memory): semantic memory, cross-session context, skill management commands#4509
herjarsa wants to merge 23 commits into
code-yeongyu:devfrom
herjarsa:feat/native-memory-foundation

Conversation

@herjarsa

@herjarsa herjarsa commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Cross-session persistent memory system for oh-my-opencode with semantic search, context injection hooks, and skill management CLI commands.

Key Features

  • Semantic Memory Engine - Persistent storage using bun:sqlite with async initialization
  • Context Injector Hook - Automatically injects relevant memories into agent context via tool.execute.after
  • Memory Management - Save, recall, search, import, and delete memories
  • Skill Management Commands - /create-skill, /update-skill-registry as built-in commands
  • find_skills Tool - Native tool to discover and install skills from registry

Technical Details

  • Uses dynamic new Function('return import("bun:sqlite")) pattern for CI bundle compatibility
  • Registered in tool-registry.ts as find_skills tool
  • Memory context injector integrated into tool guard hooks
  • All commands registered as built-in commands in the plugin

Commits

21 commits, all tests pass, typecheck clean.

Closes feature request for persistent cross-session memory.


Summary by cubic

Adds a persistent semantic memory system with semantic search and cross-session recall. Also introduces a memory CLI, a find_skills tool, and built-in skill management commands.

  • New Features

    • Semantic memory: SQLite-backed store with cosine search, importance scoring, recent, delete, and stats.
    • Hook: memory-context-injector stores key tool outcomes via tool.execute.after as context/error memories.
    • CLI: oh-my-opencode memory {search|recent|store|delete|stats|clear} for managing memories.
    • Skills: Native find_skills tool, plus /create-skill and /update-skill-registry built-in commands.
  • Migration

    • Enable the memory-context-injector hook in config to auto-store tool outcomes.
    • Requires Bun at runtime; storage uses bun:sqlite via dynamic import. Optional DB path via SEMANTIC_MEMORY_DB_PATH.

Written for commit dfc40b6. Summary will update on new commits. Review in cubic

herjarsa added 21 commits May 23, 2026 14:01
- Create @oh-my-opencode/semantic-memory package with SQLite storage
- Implement simple embedding generation using term frequency hashing
- Add cosine similarity search for semantic memory retrieval
- Create memory-context-injector hook for automatic memory storage
- Add 'omo memory' CLI with search, recent, store, delete, stats, clear commands
- Support memory types: context, decision, error, pattern, insight
- Include comprehensive test suite (13 tests)

Closes code-yeongyu#2
…errors

- Remove packages/semantic-memory package
- Move implementation to src/features/semantic-memory/
- Update imports to use relative paths
- Fix type errors by removing non-existent type imports
- Update CLI command to import from local feature
- Fix getBunSqlite() to properly await dynamic import() (was returning Promise
  instead of module, causing TypeError in tests)
- Make all memory.ts functions async (storeMemory, retrieveMemories, etc.)
- Add createMemoryContextInjector hook for automatic memory retrieval/injection
  on chat.message to provide relevant past memories as context
- Fix semantic-memory.test.ts to use async/await
- Fix hooks/semantic-memory.ts to await storeMemory calls
- Fix CLI commands to use async actions
…egistry commands

- createFindSkillsTool(): Searches .agents/skills/ and user config for matching skills
- createSkillCreatorCommand(): /create-skill - generates SKILL.md from template
- createSkillRegistryCommand(): /update-skill-registry - scans dirs, writes .atl/skill-registry.md
- Built-in auto-detection: agents can invoke find_skills when they lack capabilities
@herjarsa herjarsa closed this May 26, 2026
@herjarsa herjarsa reopened this May 26, 2026
@herjarsa

herjarsa commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #4404 (per-agent memory, clean version)

@herjarsa herjarsa closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant